<template>
  <view class="tab-page">
    <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="button" activeColor="#007aff" style="margin: 10px" />
    <view class="content">
      <view v-show="current === 0">
        <chat />
      </view>
      <view v-show="current === 1">
        <friend />
      </view>
      <view v-show="current === 2">
        <group />
      </view>
    </view>
  </view>
</template>

<script lang="ts">
import chat from '../chat/chat.vue'
import friend from '../friend/friend.vue'
import group from '../group/group.vue'

export default {
  components: {
    chat, friend, group
  },
  data() {
    return {
      items: ['消息', '好友', '群聊'],
      current: 0
    }
  },
  methods: {
    onClickItem(e: { currentIndex: number }) {
      if (this.current != e.currentIndex) this.current = e.currentIndex
    }
  },
  computed: {}
}
</script>

<style scoped lang="scss"></style>
